#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6+10;
int f[maxn];
int main() {
    string s;
    while(cin >> s && s!="."){
        f[0] = f[1] = 0;
        int L = s.size();
        for (int i = 1; i < L; ++i) {
            int j = f[i];
            while (j && s[i]!=s[j]) j = f[j];
            f[i+1] = s[i]==s[j]? j+1:0;
        }
        cout << L/(L-f[L]) << "\n";
    }
    return 0;
}
